package DbConnection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class database 
{
	public Connection getConn() 
	{
        Connection conn     = null;
        String url          = "jdbc:mysql://127.0.0.1:3306/";
        String db           = "sudeep";
        String driver       = "com.mysql.jdbc.Driver";
        String user         = "root";
        String pass         = "root";            
        try 
        {
            Class.forName(driver).newInstance();
        } 
        catch (InstantiationException e) 
        {
            e.printStackTrace();
        } 
        catch (IllegalAccessException e) 
        {
            e.printStackTrace();
        } 
        catch (ClassNotFoundException e) 
        {
            e.printStackTrace();
        }
        
        try 
        {
          conn = DriverManager.getConnection(url+db, user, pass);
        } 
        catch (SQLException e) 
        {
            System.err.println("Mysql Connection Error: ");
            e.printStackTrace();
        }
        return conn;
     }		
}
